
<script type="text/javascript" src="__STATIC__/admin/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__STATIC__/admin/js/ueditor/ueditor.all.min.js"></script>

<form class="layui-form layui-box" style='padding:25px 30px 20px 0' action="{:url()}" data-auto="true" method="post">

    <div class="layui-form-item">
        <label class="layui-form-label">传承技能</label>
        <div class="layui-input-block">
            <input type="text" autofocus name="inheritor" value='{$vo.inheritor|default=""}' required="required" title="请输入传承技能" placeholder="请输入传承技能" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">传承弟子</label>
        <div class="layui-input-block">
            <input type="text" autofocus name="inheritors" value='{$vo.inheritors|default=""}' required="required" title="请输入传承弟子" placeholder="请输入传承弟子" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">传承人名称</label>
        <div class="layui-input-block">
            <input type="text" autofocus name="truename" value='{$vo.truename|default=""}' required="required" title="请输入传承人名称" placeholder="请输入传承人名称" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">性别</label>
        <div class="layui-input-block">
            <input name="sex" value="1" title="男" {eq name='1' value='$vo.sex|default=1'}checked=""{/eq} type="radio">
            <input name="sex" value="2" title="女" {eq name='2' value='$vo.sex|default=2'}checked=""{/eq} type="radio">
            <input name="sex" value="0" title="未知" {eq name='0' value='$vo.sex|default=0'}checked=""{/eq} type="radio">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">工作职称</label>
        <div class="layui-input-block">
            <input type="text" autofocus name="title" value='{$vo.title|default=""}' required="required" title="请输入工作职称" placeholder="请输入工作职称" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <!-- <div class="layui-form-item"> -->
            <label class="layui-form-label">工作开始时间</label>
            <div class="layui-input-block">
                <input name="work_start" class="layui-input" value="{$vo.work_start|default=''}" placeholder="工作开始时间" id="work_start">
            </div>
        <!-- </div> -->
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">毕业院校</label>
        <div class="layui-input-block">
            <input type="text" autofocus name="university" value='{$vo.university|default=""}' required="required" title="请输入毕业院校" placeholder="请输入毕业院校" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">专业</label>
        <div class="layui-input-block">
            <input type="text" autofocus name="profession" value='{$vo.profession|default=""}' required="required" title="请输入专业" placeholder="请输入专业" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">学历</label>
        <div class="layui-input-block">
            <input name="education" value="1" title="中学" {eq name='1' value='$vo.education|default=1'}checked=""{/eq} type="radio">
            <input name="education" value="2" title="专科" {eq name='2' value='$vo.education|default=2'}checked=""{/eq} type="radio">
            <input name="education" value="3" title="本科" {eq name='3' value='$vo.education|default=3'}checked=""{/eq} type="radio">
            <input name="education" value="4" title="硕士及以上" {eq name='4' value='$vo.education|default=4'}checked=""{/eq} type="radio">
            <input name="education" value="0" title="小学及以下" {eq name='0' value='$vo.education|default=0'}checked=""{/eq} type="radio">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">专业证书</label>
        <div class="layui-input-block">
            <input type="text" autofocus name="profession_cert" value='{$vo.profession_cert|default=""}' required="required" title="请输入专业证书" placeholder="请输入专业证书" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">职业证书</label>
        <div class="layui-input-block">
            <input type="text" autofocus name="occupation_cert" value='{$vo.occupation_cert|default=""}' required="required" title="请输入职业证书" placeholder="请输入职业证书" class="layui-input">
        </div>
    </div>
	
    {if empty($vo['id'])}
    <div class="layui-form-item">
        <label class="layui-form-label">新的密码</label>
        <div class="layui-input-block">
            <input type="password" name="password" value='' pattern="^\S{1,}$" required=""  title="请输入新的密码" placeholder="请输入新的密码" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">重复密码</label>
        <div class="layui-input-block">
            <input type="password" name="repassword" value='' pattern="^\S{1,}$" required="" title="请输入重复密码" placeholder="请输入重复密码" class="layui-input">
        </div>
    </div>
    {/if}

    <div class="layui-form-item">
        <label class="layui-form-label">手机号码</label>
        <div class="layui-input-block">
            <input type="tel" autofocus name="phone" value='{$vo.phone|default=""}' pattern="^1[3-9][0-9]{9}$" title="请输入手机号码" placeholder="请输入手机号码" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">邮箱</label>
        <div class="layui-input-block">
            <input type="text" name="mail" pattern="^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$" value='{$vo.mail|default=""}' title="请输入邮箱" placeholder="请输入邮箱" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">职位名称</label>
        <div class="layui-input-block">
            <input type="text" autofocus name="title" value='{$vo.title|default=""}' required="required" title="请输入职位名称" placeholder="请输入职位名称" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">单位名称</label>
        <div class="layui-input-block">
            <input type="text" autofocus name="unit_name" value='{$vo.unit_name|default=""}' required="required" title="请输入单位名称" placeholder="请输入单位名称" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">头像</label>
        <div class='layui-input-block'>
            <img data-tips-image style="height:auto;max-height:32px;min-width:32px" src="{$vo.avatar|default='static/admin/theme/default/img/image.png'}"/>
            <input type="hidden" name="avatar" onchange="$(this).prev('img').attr('src', this.value)" value="{$vo.avatar|default=''}" class="layui-input">
            <a class="btn btn-link" data-file="one" data-type="png,jpg,jpeg" data-field="avatar">上传图片</a>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">身份证号码</label>
        <div class="layui-input-block">
            <input type="text" autofocus name="id_no" value='{$vo.id_no|default=""}' required="required" title="请输入身份证号码" placeholder="请输入身份证号码" class="layui-input">
        </div>
    </div>

    <!-- <div class="layui-form-item">
        <label class="layui-form-label">身份证件照片</label>
        <div class="layui-upload" id="full">
            <input id="picsPath" type="hidden" value='' class="layui-input">
            <button type="button" class="layui-btn" id="id_images1">点击上传</button>
            <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;width: 91%; margin-left: 110px;">预览图：
                <div class="layui-upload-list uploader-list" style="overflow: auto;" id="id_images2">
                    {if !empty($vo['id_images'])}
                    {volist name="vo['id_images']" id="list"}
                    <div class="file-iteme">
                        <div class="handle"><i class="glyphicon glyphicon-trash"></i></div>
                        <input type="hidden" name="id_images[]" value='{$list|default=""}' class="layui-input">
                        <img style="width: 100px;height: 100px;" src='{$list|default=""}'>
                    </div>
                    {/volist}
                    {/if}
                </div>
            </blockquote>
        </div>
    </div>
    <script>
    layui.use(['form','upload'], function () {
        var form = layui.form,upload = layui.upload;

        upload.render({
            elem: '#id_images1'
            ,url: '{:url("up_files/upImages")}'
            ,multiple: true
            ,before: function(obj){
                layer.msg('图片上传中...', {
                    icon: 16,
                    shade: 0.01,
                    time: 0
                })
            }
            ,done: function(res){
                //console.log(res);
                layer.close(layer.msg());//关闭上传提示窗口
                //上传完毕
                if(res.code == 0){
                    // $("#picsPath").val(res.src);
                    var str ='<div class="file-iteme">' +
                            '<div class="handle"><i class="glyphicon glyphicon-trash"></i></div>' +
                            '<input type="hidden" name="id_images[]" value="'+res.src+'" class="layui-input">' +
                            '<img style="width: 100px;height: 100px;" src='+ res.src +'>' +
                            '</div>'
                    $('#id_images2').append(str);
                }else{
                    layer.msg(res.msg,{time:1000,icon:2});
                } 
            }
        });

        $(document).on("mouseenter mouseleave", ".file-iteme", function(event){
            if(event.type === "mouseenter"){
                //鼠标悬浮
                //$(this).children(".info").fadeIn("fast");
                $(this).children(".handle").fadeIn("fast");
            }else if(event.type === "mouseleave") {
                //鼠标离开
                //$(this).children(".info").hide();
                $(this).children(".handle").hide();
            }
        });

        // 删除图片
        $(document).on("click", ".file-iteme .handle", function(event){
            $(this).parent().remove(); 
        });

    });
    </script> -->

    <div class="layui-form-item">
        <label class="layui-form-label">身份证件照片</label>
        <div class='layui-input-block'>
            <!-- <img data-tips-image style="height:auto;max-height:32px;min-width:32px" src="{$vo.id_images|default='static/admin/theme/default/img/image.png'}"/> -->
            <input type="hidden" name="id_images" onchange="$(this).prev('img').attr('src', this.value)" value="{$vo.id_images|default=''}" class="layui-input">
            <a class="btn btn-link" data-file="mtl" data-type="png,jpg,jpeg" data-field="id_images">上传图片</a>

            <div id="demoid_images">
                <div class="layui-row layui-col-space10">
                    {volist name="vo.id_images" id="vv" empty=""}
                    <div class="layui-col-md3" style="width: 14%;">
                        <div class="dtbox">
                            <img src="{$vv}" class="layui-upload-img" style="width:120px;height: 82px;margin-top: 8px;">
                            <input type="hidden" name="id_images[]" class="id_images" value="{$vv}">
                            <i class="delimg layui-icon">&#x1006;</i>
                        </div>
                    </div>
                    {/volist}
                </div>
            </div>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">执业证书编号</label>
        <div class="layui-input-block">
            <input type="text" autofocus name="cert_no" value='{$vo.cert_no|default=""}' required="required" title="请输入执业证书编号" placeholder="请输入执业证书编号" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">执业证书照片</label>
        <div class='layui-input-block'>
            <!-- <img data-tips-image style="height:auto;max-height:32px;min-width:32px" src="{$vo.cert_images|default='static/admin/theme/default/img/image.png'}"/> -->
            <input type="hidden" name="cert_images" onchange="$(this).prev('img').attr('src', this.value)" value="{$vo.cert_images|default=''}" class="layui-input">
            <a class="btn btn-link" data-file="mtl" data-type="png,jpg,jpeg" data-field="cert_images">上传图片</a>
            
            <div id="democert_images">
                <div class="layui-row layui-col-space10">
                    {volist name="vo.cert_images" id="vv" empty=""}
                    <div class="layui-col-md3" style="width: 14%;">
                        <div class="dtbox">
                            <img src="{$vv}" class="layui-upload-img" style="width:120px;height: 82px;margin-top: 8px;">
                            <input type="hidden" name="cert_images[]" class="cert_images" value="{$vv}">
                            <i class="delimg layui-icon">&#x1006;</i>
                        </div>
                    </div>
                    {/volist}
                </div>
            </div>
        </div>
    </div>

    {if !empty($areaList)}
    <div class="layui-form-item">
        <label class="layui-form-label">地区</label>
        <div class="layui-input-block">
            <select name='aid' required="required" title="请选择地区" class='layui-select full-width'>
                <option value="">请选择地区</option>
                {foreach $areaList as $menu}
                {eq name='menu.area_id' value='$vo.aid|default=0'}
                <option selected  value='{$menu.area_id}'>{$menu.spl}{$menu.area_name}</option>
                {else/}
                <option  value='{$menu.area_id}'>{$menu.spl}{$menu.area_name}</option>
                {/eq}
                {/foreach}
            </select>
        </div>
    </div>
    {/if}

    {if !empty($nationList)}
    <div class="layui-form-item">
        <label class="layui-form-label">民族</label>
        <div class="layui-input-block">
            <select name='nid' required="required" title="请选择民族" class='layui-select full-width'>
                <option value="">请选择民族</option>
                {foreach $nationList as $menu}
                {eq name='menu.id' value='$vo.nid|default=0'}
                <option selected  value='{$menu.id}'>{$menu.spl}{$menu.title}</option>
                {else/}
                <option  value='{$menu.id}'>{$menu.spl}{$menu.title}</option>
                {/eq}
                {/foreach}
            </select>
        </div>
    </div>
    {/if}

    <div class="layui-form-item">
        <label class="layui-form-label">简介</label>
        <div class="layui-input-block">
            <textarea placeholder="请输入简介" title="请输入简介" class="layui-textarea" name="desc">{$vo.desc|default=""}</textarea>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">荣誉</label>
        <div class="layui-input-block">
            <textarea placeholder="请输入荣誉,多条请以回车换行分隔" title="请输入荣誉" class="layui-textarea" name="honor">{$vo.honor|default=""}</textarea>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">擅长领域</label>
        <div class="layui-input-block">
            <textarea placeholder="请输入擅长领域,多条请以回车换行分隔" title="请输入擅长领域" class="layui-textarea" name="advantage">{$vo.advantage|default=""}</textarea>
        </div>
    </div>
    
    <div class="layui-form-item">
        <label class="layui-form-label">详情</label>
        <div class="layui-input-block" style="z-index:998;">
            <script id="content" name="content" type="text/plain">
                
            </script>
        </div>
    </div>


    <div class="hr-line-dashed"></div>

    <div class="layui-form-item text-center">
        <input type="hidden" id="v-content" value='{$vo.content|default=""}'>
        {if isset($vo['id'])}<input type='hidden' value='{$vo.id}' name='id'/>{/if}
        <button class="layui-btn" type='submit'>保存数据</button>
        <!-- <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消编辑吗？" data-close>取消编辑</button> -->
    </div>

    <script>window.form.render();</script>
</form>

<script type="text/javascript">

    //病情描述
    var ue1 = UE.getEditor('content');
    ue1.ready(function() {
        ue1.setHeight(200);
        var cont = $("#v-content").val();
        // alert(cont);return false;
        ue1.setContent(cont);
    });
</script>

<script>
    $('.layui-row').on('click','.delimg',function(){
        var thisimg = $(this);

        layer.confirm('你确定要删除该图片吗？', function(index){
            thisimg.parents('.layui-col-md3').remove();
            layer.close(index);
        })
    })
</script>
<script>window.form.render();</script>

<script>
    layui.use(['laydate'], function() {
        var laydate = layui.laydate;

        //日期
        laydate.render({
            elem: '#work_start'
            , max: '2099-06-16'
        });
    });
</script>